Battery chargers are well known. When charging a battery, a battery charger may operate in a constant-current mode, where the battery charger provides a constant current to charge the battery. The battery charger may also operate in a constant-voltage mode, where the battery charger provides a constant voltage to charge the battery. A problem with conventional battery chargers is that when the battery transitions from a constant-current mode to a constant-voltage mode, the battery charger may experience significantly large increases in charge current. Unfortunately, large charge currents may cause irreversible damage to the battery charger if its package is not able to dissipate the excess power. Accordingly, what is needed is an improved system and method for charging a battery. The present invention addresses such a need.